import request from '@/utils/request'

// 查询供应商list
export function listSup(query) {
  const condition = {
    page:query.pageNum,
    count:query.pageSize,
    search:{
      supId:query.supId,
      supName:query.supName,
      supAddress:query.supAddress,
      supEmail:query.supEmail,
      supContact:query.supContact,
      supTel:query.supTel,
      supBank:query.supBank,
      supAccount:query.supAccount,
      supState:query.supState,
      supType:query.supType,
    }
  }
  return request({
    url: '/purchase/sup/query',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data:  JSON.stringify(condition)
  })
}

// 查询指定仓库
export function getSup(supId) {
  return request({
    url: '/purchase/sup/' + supId,
    method: 'get'
  })
}

// 新增仓库
export function addSup(data) {
  return request({
    url: '/purchase/sup',
    method: 'post',
    data: data
  })
}

// 修改仓库信息
export function updateSup(data) {
  return request({
    url: '/purchase/sup/update',
    method: 'post',
    data: data
  })
}

// 删除仓库
export function delSup(supId) {
  return request({
    url: '/purchase/sup/' + supId,
    method: 'delete'
  })
}

// 供应商状态修改
export function changeSupStatus(supId, status) {
  const data = {
    supId,
    status
  }
  return request({
    url: '/purchase/sup/changeStatus',
    method: 'put',
    data: data
  })
}


// // 定时任务立即执行一次
// export function runJob(jobId, jobGroup) {
//   const data = {
//     jobId,
//     jobGroup
//   }
//   return request({
//     url: '/monitor/job/run',
//     method: 'put',
//     data: data
//   })
// }